<script language="javascript">
  function showLog(url)
  {
  window.open(url,'mywin','width=500,height=550,scrollbars=yes');
  return true;
  }
</script>

<div id="sidebar">
  <table cellpadding="0" cellspacing="0" style="width:100%;margin-top:-5px;">
    <tr>
      <td class="line" style="width:1px;height:500px">
        <div class="vr">
          <div></div>
        </div>
      </td>
      <td class="menuTDend" width="15px">
        &nbsp;
      </td>
      <td valign="top">
        <table cellpadding="0" cellspacing="0" style="width:100%;height:30px;">
          <tr>
            <td class="headTDright" colspan="7">
              <h2>Audit Log</h2>
            </td>
          </tr>
        </table>
        <div id="Layer1" style="position:relative;width:280px;height:600px; overflow-y:auto;margin-top:15px">
          <table cellspacing="0" cellpadding="0" width="90%"  border="0" class="tableClass" style="margin-top:0px">
            <tr class="tableHeader" height="25px">
              <th class="tableTD" width="30%">TimeStamp</th>
              <th class="tableTD" >Description</th>
              <th class="tableTD">Raw Data</th>
            </tr>
            <?php 
				$auditLogdata = LoggerClass::readLogEntry();								
				if (isset($auditLogdata) && count($auditLogdata) > 0){
					$i=0;
					foreach($auditLogdata as $key=>$value) {
						$logDate =  (string)$auditLogdata[$key]['timestamp'];
						$reqDesc = $auditLogdata[$key]['title'];
						 if($i % 2 == 0){
							$tblClass = "tableTDAlt";
						 }else {
							$tblClass = "tableTD";
						 }
			?>
				<tr>
				  <td class="<?php echo $tblClass;?>" align="left">
					<?php echo date('Y-m-d h:i:s',$logDate);?>
				  </td>
				  <td class="<?php echo $tblClass;?>" align="left">
					<?php echo $reqDesc;?>
				  </td>
				  <td class="<?php echo $tblClass;?>" align="left">
					<?php 
							if(isset($_SESSION['salesPersionID'])){
						?>
					<a href="#"  onclick="javascript:showLog('index.php?a=4&c=<?php echo $logDate;?>');return false">Details
					</a>
					<?php
							} else {
						?>
					<a href="index.php" onclick="javascript:return false;">Details</a>
					<?php
						}
						?>
				  </td>
				</tr>            
            <?php
								$i = $i+1;
					}
				}
			?>
          </table>
        </div>
      </td>
    </tr>
  </table>
</div>
<!-- end sidebar -->
<div style="clear: both;">&nbsp;</div>
</div>